package com.mzj.saas.mservice.eligible.repository;

import com.mzj.saas.mservice.eligible.entity.HouseApplyMaterial;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

public interface HouseApplyMaterialRepository extends PagingAndSortingRepository<HouseApplyMaterial, Long>, JpaSpecificationExecutor<HouseApplyMaterial> {
    List<HouseApplyMaterial> findByApplyId(Long applyId);

    List<HouseApplyMaterial> findByApplyIdAndMaterialType(Long applyId, Integer materialType);

    @Transactional
    void deleteByApplyIdAndMaterialType(Long applyId, Integer materialType);
}
